package com.zz.parkingsystem.mapper;

import com.zz.parkingsystem.dto.ExceptionOrderDTO;
import com.zz.parkingsystem.dto.OrderDTO;
import com.zz.parkingsystem.dto.RefundOrderDTO;
import com.zz.parkingsystem.entity.Order;
import com.zz.parkingsystem.vo.ExceptionOrderVO;
import com.zz.parkingsystem.vo.OrderVO;
import com.zz.parkingsystem.vo.RefundOrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* @author zz
* @description 针对表【t_order(订单表)】的数据库操作Mapper
* @createDate 2022-08-29 19:50:42
* @Entity com.zz.parkingsystem.entity.Order
*/
@Mapper
@Repository
public interface OrderMapper {
    /**
     * 订单管理
     */
    List<OrderVO> queryAllOrder(OrderDTO orderDTO);

    Long getOrderCount(OrderDTO orderDTO);

    //更改订单状态为2：已支付
    int updateOrderStatusToPaid(Long orderID);

    List<OrderVO> queryAllOrderExcel(OrderDTO orderDTO);

    /**
     * 异常订单
     */
    List<ExceptionOrderVO> queryAllExceptionOrder(ExceptionOrderDTO exceptionOrderDTO);

    Long getExceptionCount(ExceptionOrderDTO exceptionOrderDTO);

    //更改异常表状态BY订单流水号
    int updateExceptionStatus(String oiNo,Integer eoStatus);

    //通过订单流水号修改订单金额
    int updateOrderAmountByOiNo(String oiNO, BigDecimal resetAmount);

    //更改订单状态为1：未支付
    int updateOrderStatusToUnPaid(Long orderID);

    //给异常表update一个处理时间
    int updateExceptionHandleTime(String oiNo);

    List<ExceptionOrderVO> queryAllExceptionOrderExcel(ExceptionOrderDTO exceptionOrderDTO);
    /**
     * 售后订单
     */
    List<RefundOrderVO> queryAllRefundOrder(RefundOrderDTO refundOrderDTO);

    Long getRefundCount(RefundOrderDTO refundOrderDTO);

    //更改售后订单状态By主键
    int updateRefundStatusByRefId(Integer refId,Integer refStatus);

    //更改订单状态为4：已退款
    int updateOrderStatusToRefund(Long orderID);

    List<RefundOrderVO> queryAllRefundOrderExcel(RefundOrderDTO refundOrderDTO);

    int deleteByPrimaryKey(Long id);

    int insert(Order record);

    int insertSelective(Order record);

    Order selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);

    Order selOrderByStatusByPkId(Integer pkId);

    Order selOrderByOrderItemId(Integer orderItemId);

    //查所有订单状态
    List<Order> selectByAllStatus();

    Order selectOiid(Long id);
}
